import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int k = (n>m?n:m);
        while(true){
            if(m%k==0 && n%k==0){
                break;
            }
            k--;
        }
        System.out.println("最大公约数为"+k);
    }
    public static void main5(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = 0;
        for (int i = 0; i < 32; i++) {
            if(((1<<i)&n) != 0){
                sum++;
            }
        }
        System.out.println("二进制1的个数为 "+sum);
    }
    public static void main4(String[] args) {
        double sum = 0;
        for (int i = 1; i <= 100; i++) {
            sum += 1.0/i;
        }
        System.out.println("sum = "+sum);
    }

   public static void main3(String[] args) {
       int sum = 0;
       Scanner scanner = new Scanner(System.in);
       int n = scanner.nextInt();
       int tmp = n;
       while(tmp != 0){
           int k = tmp % 10;
           sum += k * k * k;
           tmp /= 10;
       }
       if(sum == n){
           System.out.println(n+"是水仙花数");
       } else{
           System.out.println(n+"不是水仙花数");
       }
    }

    public static void main2(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int flag = 1;
        for (int i = 2; i < n; i++) {
            if(n % i == 0) {
                System.out.println("不是素数");
                flag = 0;
                break;
            }
        }

        if(flag == 1){
            System.out.println("是素数");
        }

    }

    public static void main1(String[] args) {
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            int tmp = i;
            while(tmp != 0){
                if(tmp % 10 == 9) {
                    count++;
                }
                tmp /= 10;
            }
        }
        System.out.println(count);
    }
}
